﻿using MugenInjection.Logging.Interface.Components;
using MugenInjection.Logging.Log4Net.Components;
using MugenInjection.Logging.Modules;

namespace MugenInjection.Logging.Log4Net.Modules
{
    /// <summary>
    /// Implementation for log4net logger.
    /// </summary>
    public class Log4NetModule : LoggerModuleBase
    {
        #region Overrides of LoggerModuleBase

        /// <summary>
        /// Load bindings and components in current module. 
        /// </summary>
        public override void Load()
        {
            base.Load();
            ILoggerFactory loggerFactory;
            if (Injector.Components.TryGet(out loggerFactory) && loggerFactory is Log4NetFactoryComponent)
                return;
            AddComponent(new Log4NetFactoryComponent());
        }

        #endregion
    }
}